<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
      <title>GTL - Graph Template Library: maxflow_sap.h Source File</title>
      <link href="doxygen.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <p class="links">  
      <a href="../index.html">Home</a> |
      Documentation |
      <a href="../register.html">Download</a> |
      <a href="../platforms.html">Platforms</a> |
      <a href="../refer.html">Projects</a> |      
      <a href="../lists.html">Mailing Lists</a> |
      <a href="../history.html">Version History</a>
    </p>

<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>maxflow_sap.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==========================================================================</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">//   maxflow_sap.h</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">//==========================================================================</span>
<a name="l00006"></a>00006 <span class="comment">// $Id: maxflow_sap.h,v 1.4 2003/01/31 08:15:05 chris Exp $</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef GTL_MAXFLOW_SAP_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GTL_MAXFLOW_SAP_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;GTL/GTL.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;GTL/graph.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;GTL/node_map.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;GTL/edge_map.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;GTL/algorithm.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;queue&gt;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 __GTL_BEGIN_NAMESPACE
<a name="l00020"></a>00020 
<a name="l00033"></a><a class="code" href="a00017.html">00033</a> <span class="keyword">class </span>GTL_EXTERN <a class="code" href="a00017.html" title="Maximum flow algorithm with shortest augmenting paths.">maxflow_sap</a> : <span class="keyword">public</span> <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035 <span class="keyword">public</span>:
<a name="l00042"></a>00042     <a class="code" href="a00017.html" title="Maximum flow algorithm with shortest augmenting paths.">maxflow_sap</a>();
<a name="l00043"></a>00043 
<a name="l00049"></a>00049     <span class="keyword">virtual</span> ~<a class="code" href="a00017.html" title="Maximum flow algorithm with shortest augmenting paths.">maxflow_sap</a>();
<a name="l00050"></a>00050 
<a name="l00058"></a>00058     <span class="keywordtype">void</span> set_vars(<span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; edge_capacity);
<a name="l00059"></a>00059 
<a name="l00067"></a>00067     <span class="keywordtype">void</span> set_vars(<span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; edge_capacity, 
<a name="l00068"></a>00068                                   <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; net_source, 
<a name="l00069"></a>00069                                   <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; net_target);
<a name="l00070"></a>00070 
<a name="l00088"></a>00088     <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00001.html#76361fb03ad1cf643affc51821e43bed" title="Checks whether all preconditions are satisfied.">check</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00089"></a>00089             
<a name="l00098"></a>00098     <span class="keywordtype">int</span> <a class="code" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca" title="Applies algorithm to graph g.">run</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00099"></a>00099                 
<a name="l00106"></a>00106     <span class="keywordtype">double</span> get_max_flow(<span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; e) <span class="keyword">const</span>;
<a name="l00107"></a>00107 
<a name="l00113"></a>00113     <span class="keywordtype">double</span> get_max_flow() <span class="keyword">const</span>;
<a name="l00114"></a>00114         
<a name="l00121"></a>00121     <span class="keywordtype">double</span> get_rem_cap(<span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; e) <span class="keyword">const</span>;
<a name="l00122"></a>00122 
<a name="l00129"></a>00129     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00001.html#21aba63d066ae7897de6ca7d8425c408" title="Resets algorithm.">reset</a>();
<a name="l00130"></a>00130 <span class="keyword">protected</span>:
<a name="l00134"></a>00134     <span class="keyword">enum</span> {AP_FOUND = 2, NO_AP_FOUND = 3};
<a name="l00135"></a>00135 
<a name="l00139"></a>00139     <span class="keywordtype">bool</span> artif_source_target;
<a name="l00140"></a>00140 
<a name="l00144"></a>00144     <span class="keywordtype">bool</span> set_vars_executed;
<a name="l00145"></a>00145 
<a name="l00149"></a>00149     <span class="keywordtype">double</span> max_graph_flow;
<a name="l00150"></a>00150 
<a name="l00154"></a>00154     <a class="code" href="a00020.html" title="A node in a graph.">node</a> net_source;
<a name="l00155"></a>00155 
<a name="l00159"></a>00159     <a class="code" href="a00020.html" title="A node in a graph.">node</a> net_target;
<a name="l00160"></a>00160 
<a name="l00164"></a>00164     list&lt;edge&gt; edges_not_org;
<a name="l00165"></a>00165 
<a name="l00169"></a>00169     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> dist_label;
<a name="l00170"></a>00170         
<a name="l00174"></a>00174     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;bool&gt;</a> edge_org;
<a name="l00175"></a>00175 
<a name="l00179"></a>00179     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;bool&gt;</a> back_edge_exists;
<a name="l00180"></a>00180 
<a name="l00184"></a>00184     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;edge&gt;</a> back_edge;
<a name="l00185"></a>00185 
<a name="l00189"></a>00189     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> edge_capacity;
<a name="l00190"></a>00190 
<a name="l00194"></a>00194     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> edge_max_flow;
<a name="l00195"></a>00195 
<a name="l00199"></a>00199     <span class="keywordtype">void</span> create_artif_source_target(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00200"></a>00200 
<a name="l00204"></a>00204     <span class="keywordtype">void</span> prepare_run(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00205"></a>00205 
<a name="l00209"></a>00209         <span class="keywordtype">void</span> comp_dist_labels(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, vector&lt;int&gt;&amp; numb);
<a name="l00210"></a>00210 
<a name="l00214"></a>00214         <span class="keywordtype">bool</span> has_an_admissible_arc(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a> cur_node);
<a name="l00215"></a>00215 
<a name="l00219"></a>00219         <span class="keywordtype">void</span> advance(<a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; cur_node, <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge);
<a name="l00220"></a>00220 
<a name="l00224"></a>00224         <span class="keywordtype">void</span> augment(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <span class="keyword">const</span> <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge);
<a name="l00225"></a>00225 
<a name="l00229"></a>00229         <span class="keywordtype">bool</span> retreat(<span class="keyword">const</span> <span class="keywordtype">int</span> number_of_nodes,
<a name="l00230"></a>00230                                  <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; cur_node,
<a name="l00231"></a>00231                                  <span class="keyword">const</span> <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge,
<a name="l00232"></a>00232                                  vector&lt;int&gt;&amp; numb);
<a name="l00233"></a>00233 
<a name="l00237"></a>00237         <span class="keywordtype">int</span> min_neighbour_label(<span class="keyword">const</span> <span class="keywordtype">int</span> number_of_nodes,
<a name="l00238"></a>00238                                                         <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a> cur_node) <span class="keyword">const</span>;
<a name="l00239"></a>00239 
<a name="l00243"></a>00243     <span class="keywordtype">double</span> free_capacity(<span class="keyword">const</span> <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge) <span class="keyword">const</span>;
<a name="l00244"></a>00244 
<a name="l00248"></a>00248     <span class="keywordtype">void</span> create_back_edge(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; org_edge);
<a name="l00249"></a>00249 
<a name="l00253"></a>00253     <span class="keywordtype">void</span> comp_max_flow(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00254"></a>00254 
<a name="l00258"></a>00258     <span class="keywordtype">void</span> restore_graph(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00259"></a>00259 };
<a name="l00260"></a>00260 
<a name="l00261"></a>00261 __GTL_END_NAMESPACE
<a name="l00262"></a>00262 
<a name="l00263"></a>00263 <span class="preprocessor">#endif // GTL_MAXFLOW_SAP_H</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span>
<a name="l00265"></a>00265 <span class="comment">//--------------------------------------------------------------------------</span>
<a name="l00266"></a>00266 <span class="comment">//   end of file</span>
<a name="l00267"></a>00267 <span class="comment">//--------------------------------------------------------------------------</span>
</pre></div>    <p class="links">
      <a href="http://www.uni-passau.de/">University of Passau</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/">FMI</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
	Computer Science</a>
    </p>
  <div class="copyright">
      Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>,  University of Passau 
  </div>
</body>
</html>
